#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int ret = 0, num = 1;
    for (int i = 1; i < n; i++)
    {
        if (a[i] <= a[i - 1] + 8) num++;
        else ret = max(ret, num), num = 1;
    }
    ret = max(num, ret);
    cout << ret;
    return 0;
}